<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%-- 引入页面头 --%>
<%@ include file="/pageHead.jsp"%>
<form name="form1" id="form1" action="" method="post">
	<div class="pageMain">
		<div class="pageTitle">
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.bascsetting.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.title") %>
		<span></span>
		<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.listtitle") %>
		</div>
		<div class="pageBody">
			<div class="form-group">
				<ul>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.taskcode") %></label>
						<input type="text" class="input-sm" id="taskcode" name="taskcode" value="" maxlength="10"/>
					</li>
					<li>
						<i></i>
						<label><%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.taskname") %></label>
						<input type="text" class="input-sm" id="taskname" name="taskname" value="" maxlength="20"/>
					</li>
				</ul>
			</div>
		</div>
		<div class="button-group">
			<input type="button" class="btn btn-default" id="butQuery" name="butQuery" value="<%=MessageResourcesUtils.getMessage(request, "common.button.query") %>" />
			<input type="button" class="btn btn-default" id="butSynchro" name="butSynchro" value="<%=MessageResourcesUtils.getMessage(request, "common.button.synchro") %>" />
		</div>
		<table width="100%">
			<tbody>
				<tr>
					<td>
						<table id="datagrid"></table>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</form>
<script type="text/javascript">
$(document).ready(function() {
		//加载分页控件 datagrid
		$('#datagrid').issdatagrid({
			formid : 'form1',
			title : '<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.listtitle") %>',
			width : 'auto',
			singleSelect : true,
			url : '${systemctx}/systemManage/handAutoTask/queryHandAutoTaskListInfoDataGrid.json',
			sortName : 'id',
			sortOrder : 'desc',
			idField : 'id',
			queryParams:$('#form1').serializeObject(),
			frozenColumns :[[
				{field:'ck', checkbox:true},
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.taskcode")%>',field :'code',width:260,sortable: true,align : 'left'},  
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.taskname")%>',field :'name',width:160,sortable: true,align : 'left'}
			]],
			columns : [[
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.execlass")%>',field :'executeclass',width:450,sortable: true,align : 'left'}, 
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.exemodel")%>',field :'executemodel',width:100,sortable: true,align : 'center'}, 
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.exestatus")%>',field :'executestatus',width:80,sortable: true,align : 'center'}, 
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.taskstatus")%>',field :'taskstatus',width:80,sortable: true,align : 'center'}, 
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.servername")%>',field :'servername',width:140,sortable: true,align : 'left'}, 
				{title :'<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.taskdesc")%>',field : 'description',width : 180,sortable : true,align : 'left'} 
			]],
			onLoadSuccess : function(data) {

			}
		});
	
		$('#butQuery').click(function(){
			$('#datagrid').datagrid('load',$('#form1').serializeObject());
		});
		
		$('#butSynchro').click(function() {
			var idStr="";
			var rows=$('#datagrid').datagrid("getChecked");
			if(rows.length<1){
				alert("<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.alert")%>");
				return;
			}else{
				for(var i=0;i<rows.length;i++){
					idStr=rows[i]["id"] + "," + idStr;
				}
			}
			if (confirm("<%=MessageResourcesUtils.getMessage(request, "systemmanage.headautotask.list.confirm")%>")) {
				showSending();
				$.ajax({
					type : 'POST',
					url : '${systemctx}/systemManage/handAutoTask/synchronousHandAutoTask.json?id='+idStr,
					dataType : 'json',
					success : function(data) {
						//关闭执行...
						closeSending();
						if(data.messagetype == '<%=SysConstant.RecordStatus.VALID%>'){
							//显示AJAX请求后的提示信息
							alert(data.message);
						}
						///$.fn.ajaxmessage(data);
						////$('#datagrid').datagrid('reload',$('#form1').serializeObject());
						///$('#datagrid').datagrid('clearSelections');
					}
				});
			}
		});
});
</script>
<%-- 引入页面尾 --%>
<%@ include file="/pageFloor.jsp"%>